﻿using BCCommon.Enums;
using BCCommon.Extensions;
using BCCommon.FreightEnums;
using BCCommon.PaymentEnums;
using BCCommon.TMS.Order;
using System;
using System.Collections.Generic;
using System.Text;

namespace BCDto.TMS.Order.OrderExtention
{
    /// <summary>
    /// 订单扩展信息
    /// </summary>
    public class OrderExtentionDto
    {
        /// <summary>
		/// 订单扩展信息Id
        /// </summary>
        public long OrderExtentionId { get; set; }
        /// <summary>
        /// 货车装货左侧照片地址
        /// </summary>
        public string LoadPhotoLeft { get; set; }
        /// <summary>
        /// 货车装货正面照片地址
        /// </summary>
        public string LoadPhotoFront { get; set; }

        /// <summary>
        /// 货车装货背面照片地址
        /// </summary>
        public string LoadPhotoBack { get; set; }
        /// <summary>
        /// 与货主合影
        /// </summary>
        public string LoadPhotoShipping { get; set; }
        /// <summary>
        /// 订单Id
        /// </summary>
        public long OrderId { get; set; }
        /// <summary>
        /// 订单编号
        /// </summary>
        public string OrderNo { get; set; }
        /// <summary>
        /// 目的地地址
        /// </summary>
        public string EndAddress { get; set; }
        /// <summary>
        /// 目的地地址（短地址）
        /// </summary>
        public string EndAddressShort { get { if (!string.IsNullOrWhiteSpace(EndAddress)) { return EndAddress.Length > 20 ? EndAddress.Substring(0, 20) + "..." : EndAddress; } else { return ""; } } }
        /// <summary>
        /// 目的地省Id
        /// </summary>
        public string EndProvinceCode { get; set; }
        /// <summary>
        /// 目的地城市Id
        /// </summary>
        public string EndCityCode { get; set; }
        /// <summary>
        /// 目的地区县Id
        /// </summary>
        public string EndCountyCode { get; set; }
        /// <summary>
        /// 区域名称
        /// </summary>
        public string AreaName { get { return ProvinceName.Equals(CityName) ? string.Format("{0} {1}", ProvinceName, CountyName) : string.Format("{0} {1} {2}", ProvinceName, CityName, CountyName); } }
        /// <summary>
        /// 目的地省名称
        /// </summary>
        public string ProvinceName { get; set; }
        /// <summary>
        /// 目的地城市名称
        /// </summary>
        public string CityName { get; set; }
        /// <summary>
        /// 目的地区县名称
        /// </summary>
        public string CountyName { get; set; }
        /// <summary>
        /// 目的地经度
        /// </summary>
        public double EndLongitude { get; set; }
        /// <summary>
        /// 目的地纬度
        /// </summary>
        public double EndLatitude { get; set; }
        /// <summary>
		/// 货物SKU
        /// </summary>		
        public string GoodsSku { get; set; }
        /// <summary>
        /// 货物照片
        /// </summary>		
        public string GoodsPhoto { get; set; }
        /// <summary>
        /// 货物名称
        /// </summary>		
        public string GoodsName { get; set; }
        /// <summary>
        /// 货物重量
        /// </summary>		
        public decimal? GoodsWeight { get; set; }
        /// <summary>
        /// 货物体积
        /// </summary>		
        public decimal? GoodsVolume { get; set; }
        /// <summary>
        /// 货物长度
        /// </summary>		
        public decimal? GoodsLength { get; set; }
        /// <summary>
        /// 货物宽度
        /// </summary>		
        public decimal? GoodsWidth { get; set; }
        /// <summary>
        /// 货物高度
        /// </summary>		
        public decimal? GoodsHeight { get; set; }
        /// <summary>
        /// 货物数量
        /// </summary>		
        public int? GoodsCount { get; set; }
        /// <summary>
        /// 货物单价
        /// </summary>		
        public decimal? GoodsPrice { get; set; }
        /// <summary>
        /// 货物单位
        /// </summary>		
        public string GoodsUnit { get; set; }
        private string consigneeName;
        /// <summary>
        /// 收货人姓名
        /// </summary>
        public string Consignee
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(consigneeName))
                {
                    return string.Format("{0}师傅", consigneeName.Substring(0, 1));
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                consigneeName = value;
            }
        }
        /// <summary>
        /// 收货人性别
        /// </summary>
        public ContacterGenderType ConsigneeGender { get; set; }
        /// <summary>
        /// 收货人性别
        /// </summary>
        public string ConsigneeGenderStr { get { return this.ConsigneeGender.GetDescriptionString(); } }
        /// <summary>
        /// 收货人电话
        /// </summary>
        public string ConsigneePhone { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 出发时间
        /// </summary>
        public DateTime? StartTime { get; set; }
        /// <summary>
        /// 到达时间
        /// </summary>
        public DateTime? EndTime { get; set; }
        /// <summary>
        /// 付款时间--运费付款时间
        /// </summary>
        public DateTime? PayTime { get; set; }
        /// <summary>
        /// 目的地顺序(升序排列)
        /// </summary>
        public int EndIndex { get; set; }
        /// <summary>
        /// 地址类型
        /// </summary>
        public AddressType AddressType { get; set; }
        /// <summary>
        /// 地址类型
        /// </summary>
        public string AddressTypeStr { get { return AddressType.GetDisplayString(); } }
        /// <summary>
        /// 超时分钟
        /// </summary>
        public int TimeOutMinute { get; set; }
        /// <summary>
        /// 问题订单
        /// </summary>
        public bool IsProblemOrder { get; set; }
        /// <summary>
        /// 已超时
        /// </summary>
        public bool IsTimeout { get; set; }

        /// <summary>
        /// 已收款
        /// </summary>
        public bool? IsCashed { get; set; }

        /// <summary>
        /// 收款方式
        /// </summary>
        public PaymentChannelType? CashMode { get; set; }
        /// <summary>
        /// 收款方式
        /// </summary>
        public string CashModeStr { get { return CashMode.HasValue ? CashMode.GetDisplayString() : ""; } }

        /// <summary>
        /// 超时索赔金额
        /// </summary>
        public decimal? TimeoutClaimPay { get; set; }

        /// <summary>
        /// 超时时效分钟
        /// </summary>
        public int? AgingMinutes { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public OrderStatus OrderStatus { get; set; }
        /// <summary>
        /// 订单状态
        /// </summary>
        public string OrderStatusStr { get { return OrderStatus.GetDisplayString(); } }
        /// <summary>
        /// 问题订单备注
        /// </summary>
        public string ProblemOrderRemark { get; set; }

        /// <summary>
        /// 收款时间--代收货款收款时间
        /// </summary>
        public DateTime? CashedTime { get; set; }
        /// <summary>
        /// 验收时间
        /// </summary>
        public DateTime? AcceptanceTime { get; set; }
        /// <summary>
        /// 验收签名
        /// </summary>
        public string AcceptanceSignature { get; set; }
        /// <summary>
        /// 验收拍照
        /// </summary>
        public string AcceptancePhoto { get; set; }

        /// <summary>
        /// 运费金额
        /// </summary>
        public decimal FreightCost { get; set; }
        /// <summary>
        /// 距离长度
        /// </summary>
        public decimal DistanceLength { get; set; }

        /// <summary>
        /// 大屏统计货源点量级时使用字段
        /// </summary>
        public int Quantity { get; set; }
    }
}
